import Vue from 'vue'
import request from '@/itsoftUI/utils/request'
import qs from "qs"
const baseUrl = Vue.prototype.$itsoftUI.config.serviceUrl + "/apartment/report"
//库房商品
const apiReport = {
    // 列表
    List: function (search, order, page, fields) {
        const data = {
            search,
            fields,
            order,
            page
        }
        return request({
            url: baseUrl + '/list',
            method: 'post',
            data: qs.stringify(data)
        })
    },


    //提取信息
    Get: function (id) {
        const data = {
            id
        }
        return request({
            url: baseUrl + '/get',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //添加
    Add: function (goods, storehouse) {
        const data = {
            goods,
            storehouse
        }
        return request({
            url: baseUrl + '/add',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //编辑
    Edit: function (data) {
        const config = {
            headers: {'Content-Type': 'application/json;charset=utf-8'},
        }
        return request.post(baseUrl + '/edit', data, config)
    },
    // 删除
    Del: function (ids) {
        const data = {
            ids
        }
        return request({
            url: baseUrl + '/del',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    // 获取字段
    TableField: function (table) {
        const data = {
            table
        }
        return request({
            url: baseUrl + '/gettablecolumns',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    // 获取字段
    ListDict: function (table,fields) {
        const data = {
            table,fields
        }
        return request({
            url: baseUrl + '/listdict',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    // 获取字段
    DataSource: function (type,fields) {
        const data = {
            type,fields
        }
        return request({
            url: baseUrl + '/DataSource',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    // 列表
    DataList: function (search, order, page,table,fields,groupby) {
        const data = {
            search,
            order,
            page,
            table,
            fields,
            groupby
        }
        return request({
            url: baseUrl + '/datalist',
            method: 'post',
            data: qs.stringify(data)
        })
    },
}
export {apiReport}
